package logic;
// Account.java
// Represents a customer account

public class Account {

	private int cpr; // accountholders cpr
	private int pin; // accountholders PIN
	private String firstName; // accountholders firstname
	private String lastName; // accountholders lastname
	private int accountNumber; // account number
	private double availableSpendingBalance; // funds available for withdrawal of spending account
	private double totalSpendingBalance; // funds available + pending deposits of spending account
	private double totalSavingsBalance; // funds available + pending deposits of savings account
	private double availableBudgetBalance; // funds available for withdrawal of budget account
	private double totalBudgetBalance; // funds available + pending deposits of budget account

	// Account constructor initializes attributes
	public Account(int theAccountNumber, int thePIN, String theFirstName,
			String theLastName, int theCpr, double theAvailableSpendingBalance,
			double theTotalSpendingBalance, double theTotalSavingsBalance,
			double theAvailableBudgetBalance, double theTotalBudgetBalance) {
		accountNumber = theAccountNumber;
		firstName = theFirstName;
		lastName = theLastName;
		cpr = theCpr;
		pin = thePIN;
		availableSpendingBalance = theAvailableSpendingBalance;
		totalSpendingBalance = theTotalSpendingBalance;
		totalSavingsBalance = theTotalSavingsBalance;
		availableBudgetBalance = theAvailableBudgetBalance;
		totalBudgetBalance = theTotalBudgetBalance;
	} // end Account constructor

	// determines whether a user-specified PIN matches PIN in Account
	public boolean validatePIN(int userPIN) {
		if (userPIN == pin)
			return true;
		else
			return false;
	} // end method validatePIN

	// returns accountholders firstname
	public String getFirstName() {
		return firstName;
	} // end getFirstName

	// returns accountholders lastname
	public String getLastName() {
		return lastName;
	} // end getLastName

	// returns accountholders CPR
	public int getCpr() {
		return cpr;
	} // end getCpr

	// returns available balance of spending-account
	public double getAvailableSpendingBalance() {
		return availableSpendingBalance;
	} // end getAvailableSpendingBalance

	// returns the total balance of spending-account
	public double getTotalSpendingBalance() {
		return totalSpendingBalance;
	} // end method getTotalSpendingBalance

	// credits an amount to the spending-account
	public void credit(double amount) {
		availableSpendingBalance += amount; // add to available balance of
											// spending-account
		totalSpendingBalance += amount; // add to total balance of
										// spending-account
	} // end method credit

	// debits an amount from the spending-account
	public void debit(double amount) {
		availableSpendingBalance -= amount; // subtract from available balance
											// of spending-account
		totalSpendingBalance -= amount; // subtract from total balance of
										// spending-account
	} // end method debit

	// returns account number
	public int getAccountNumber() {
		return accountNumber;
	} // end method getAccountNumber

	// returns the total balance of savings-account
	public double getTotalSavingsBalance() {
		return totalSavingsBalance;
	} // end method getTotalSavingsBalance

	// credits an amount to the savings-account
	public void creditSavings(double amount) {
		totalSavingsBalance += amount; // add to total balance of
										// savings-balance
	} // end method credit

	// debits an amount from the savings-account
	public void debitSavings(double amount) {
		totalSavingsBalance -= amount; // subtract from total balance of
										// savings-account
	} // end method debit

	// returns available balance of savings-account
	public double getAvailableBudgetBalance() {
		return availableBudgetBalance;

	} // end getAvailableBudgetBalance

	// returns the total balance of budget-account
	public double getTotalBudgetBalance() {
		return totalBudgetBalance;
	} // end method getTotalBudgetBalance

	// credits an amount to the budget-account
	public void creditBudget(double amount) {
		availableBudgetBalance += amount; // add to available balance of
											// budget-balance
		totalBudgetBalance += amount; // add to total balance of budget-balance
	} // end method credit

	// debits an amount from the budget-account
	public void debitBudget(double amount) {
		availableBudgetBalance -= amount; // subtract from available balance of
											// budget-account
		totalBudgetBalance -= amount; // subtract from total balance of
										// budget-account
	}

	// returns accountholders PIN
	public int getPin() {
		return pin;
	} // end method getPin

	// sets the value of PIN
	public void setPin(int pin) {
		this.pin = pin;
	} // end method setPin

	// sets the value of accountnumber
	public void setAccountNumber(int accountNumber) {
		this.accountNumber = accountNumber;
	} // end method setAccountNumber

	// sets the value of fistname
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	} // end method setFirstName

	// sets the value of lastname
	public void setLastName(String lastName) {
		this.lastName = lastName;
	} // end method setLastName

	// sets the value of CPR
	public void setCpr(int cpr) {
		this.cpr = cpr;
	} // end method setCpr

	// sets the value of available balance of spending-account
	public void setAvailableSpendingBalance(double availableSpendingBalance) {
		this.availableSpendingBalance = availableSpendingBalance;
	} // end method setAvailableSpendingBalance

	// sets the value of the total balance of spending-account
	public void setTotalSpendingBalance(double totalSpendingBalance) {
		this.totalSpendingBalance = totalSpendingBalance;
	} // end method setTotalSpendingBalance

	// sets the value of the total balance of savings-account
	public void setTotalSavingsBalance(double totalSavingsBalance) {
		this.totalSavingsBalance = totalSavingsBalance;
	} // end method setTotalSavingsBalance

	// sets the value of available balance of budget-account
	public void setAvailableBudgetBalance(double availableBudgetBalance) {
		this.availableBudgetBalance = availableBudgetBalance;
	} // end method setAvailableBudgetBalance

	// sets the value of total balance of budget-account
	public void setTotalBudgetBalance(double totalBudgetBalance) {
		this.totalBudgetBalance = totalBudgetBalance;
	} // end method setTotalBudgetBalance

	public void setotalSpendingBalance(double totalSpendingBalance) {
		this.totalSpendingBalance = totalSpendingBalance;
	}

} // end class Account

